<!doctype html>
<html>
<head>
<?php $this->load->view('admin/common_head'); ?>
</head>
<body>
<div class="wrap">
	<div class="nav">
		<div class="return"><a href="<?php echo site_url('admin/agency/index'); ?>">返回上一级</a></div>
		<ul class="cc">
			<li><a href="<?php echo site_url('admin/agency/edit?action=base&agencyid='.$agencyid); ?>">基本资料</a></li>
			<li><a href="<?php echo site_url('admin/agency/edit?action=data&agencyid='.$agencyid); ?>">数据资料</a></li>
			<li class="current"><a href="<?php echo site_url('admin/agency/edit?action=right&agencyid='.$agencyid); ?>">权限设置</a></li>
		</ul>
	</div>
	<form id="J_agency_right_form" action="<?php echo site_url('admin/agency/do_edit_right'); ?>" method="post" accept-charset="utf-8">
		<input type="hidden" name="right[agencyid]" value="<?php echo $agencyid; ?>" />
		<div class="h_a">基本资料</div>
		<div class="table_full">
			<table width="100%">
				<col class="th" />
				<col/>
				<tbody>
					<tr>
						<th>中介名称</th>
						<td><?php echo $agency['name']; ?> （中介ID：<?php echo $agency['agencyid']; ?>）</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="J_tabs_contents">
			<!-- 二手权限 -->
			<div>
				<div class="h_a">基本设置</div>
				<div class="table_full">
					<table width="100%">
						<col class="th" />
						<col width="400" />
						<col />
						<tr>
							<th>发布出售</th>
							<td>
								<ul class="switch_list cc">
									<li class="current">
										<label>
											<input type="radio" name="right[sale_publish]" value="1" <?php echo set_radio('right[sale_publish]',1,isset($right['sale_publish']) && $right['sale_publish'] == 1); ?> />
											<span>开启</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" name="right[sale_publish]" value="0" <?php echo set_radio('right[sale_publish]',0,isset($right['sale_publish']) ? $right['sale_publish'] == 0 : TRUE); ?> />
											<span>关闭</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips"></div></td>
						</tr>
						<tr>
							<th>发布出租</th>
							<td>
								<ul class="switch_list cc">
									<li>
										<label>
											<input type="radio" name="right[hire_publish]" value="1" <?php echo set_radio('right[hire_publish]',1,isset($right['hire_publish']) && $right['hire_publish'] == 1); ?> />
											<span>开启</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" name="right[hire_publish]" value="0" <?php echo set_radio('right[hire_publish]',0,isset($right['hire_publish']) ? $right['hire_publish'] == 0 : TRUE); ?> />
											<span>关闭</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips"></div></td>
						</tr>
						<!--
						<tr>
							<th>批量发布出售</th>
							<td>
								<ul class="switch_list cc">
									<li>
										<label>
											<input type="radio" name="sale_publish_batch" value="1" />
											<span>开启</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" name="sale_publish_batch" value="0" />
											<span>关闭</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips"></div></td>
						</tr>
						<tr>
							<th>批量发布出租</th>
							<td>
								<ul class="switch_list cc">
									<li>
										<label>
											<input type="radio" name="hire_publish_batch" value="1" />
											<span>开启</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" name="hire_publish_batch" value="0" />
											<span>关闭</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips"></div></td>
						</tr>
						-->
						<tr>
							<th>房源审核</th>
							<td>
								<ul class="switch_list cc">
									<li>
										<label>
											<input type="radio" name="right[second_publish_check]" value="1" <?php echo set_radio('right[second_publish_check]',1,isset($right['second_publish_check']) && $right['second_publish_check'] == 1); ?> />
											<span>开启</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" name="right[second_publish_check]" value="0" <?php echo set_radio('right[second_publish_check]',0,isset($right['second_publish_check']) ? $right['second_publish_check'] == 0 : TRUE); ?> />
											<span>关闭</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips">开启后需要发布的房源需要审核</div></td>
						</tr>
						<tr>
							<th>中介店铺</th>
							<td>
								<ul class="switch_list cc">
									<li>
										<label>
											<input type="radio" name="right[second_user_shop]" value="1" <?php echo set_radio('right[second_user_shop]',1,isset($right['second_user_shop']) && $right['second_user_shop'] == 1); ?> />
											<span>开启</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" name="right[second_user_shop]" value="0" <?php echo set_radio('right[second_user_shop]',0,isset($right['second_user_shop']) ? $right['second_user_shop'] == 0 : TRUE); ?> />
											<span>关闭</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips"></div></td>
						</tr>
					</table>
				</div>
				<div class="h_a">权限设置</div>
				<div class="table_full">
					<table width="100%">
						<col class="th" />
						<col width="400" />
						<col />
						<tr>
							<th>不分出售出租（合并）</th>
							<td>
								<ul id="J_ifpostall_type" class="switch_list cc">
									<li class="current">
										<label>
											<input data-title="s1" data-type="" type="radio" name="right[second_publish_merge]" value="1" <?php echo set_radio('right[second_publish_merge]',1,isset($right['second_publish_merge']) ? $right['second_publish_merge'] == 1 : TRUE); ?> />
											<span>开启</span>
										</label>
									</li>
									<li>
										<label>
											<input  data-title="s2" data-type="J_ifpostall_s2" type="radio" name="right[second_publish_merge]" value="0" <?php echo set_radio('right[second_publish_merge]',0,isset($right['second_publish_merge']) && $right['second_publish_merge'] == 0); ?> />
											<span>关闭</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div id="J_ifpostall_tip" class="fun_tips">开启后，以下的出售出租设置无效</div></td>
						</tr>
						<tr>
							<th>房源发布权限</th>
							<td>
								<ul class="switch_list cc">
									<li>
										<label>
											<input type="radio" value="day" name="right[second_publish_type]" <?php echo set_radio('right[second_publish_type]','day',isset($right['second_publish_type']) ? $right['second_publish_type'] == 'day' : TRUE); ?> />
											<span>按天发布</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" value="month" name="right[second_publish_type]" <?php echo set_radio('right[second_publish_type]','month',isset($right['second_publish_type']) && $right['second_publish_type'] == 'month'); ?> />
											<span>按月发布</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" value="fixed" name="right[second_publish_type]" <?php echo set_radio('right[second_publish_type]','fixed',isset($right['second_publish_type']) && $right['second_publish_type'] == 'fixed'); ?> />
											<span>固定数量</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips"></div></td>
						</tr>
						<tr>
							<th>房源发布数量</th>
							<td><input type="text" name="right[second_publish_num]" value="<?php echo isset($right['second_publish_num']) ? $right['second_publish_num'] : ''; ?>" class="input length_5"></td>
							<td><div class="fun_tips">0 或 留空 表示没限制</div></td>
						</tr>
					</table>
				</div>
				<div id="J_ifpostall_s2" class="table_full J_ifpostall_tbody" style="display:none;">
					<div class="h_a">出售权限</div>
					<table width="100%">
						<col class="th" />
						<col width="400" />
						<col />
						<tr>
							<th>出售发布权限</th>
							<td>
								<ul class="switch_list cc">
									<li>
										<label>
											<input type="radio" value="day" name="right[sale_publish_type]" <?php echo set_radio('right[sale_publish_type]','day',isset($right['sale_publish_type']) ? $right['sale_publish_type'] == 'day' : TRUE); ?> />
											<span>按天发布</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" value="month" name="right[sale_publish_type]" <?php echo set_radio('right[sale_publish_type]','month',isset($right['sale_publish_type']) && $right['sale_publish_type'] == 'month'); ?> />
											<span>按月发布</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" value="fixed" name="right[sale_publish_type]" <?php echo set_radio('right[sale_publish_type]','fixed',isset($right['sale_publish_type']) && $right['sale_publish_type'] == 'fixed'); ?> />
											<span>固定数量</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips"></div></td>
						</tr>
						<tr>
							<th>出售发布数量</th>
							<td><input type="text" name="right[sale_publish_num]" value="<?php echo isset($right['sale_publish_num']) ? $right['sale_publish_num'] : ''; ?>" class="input length_5"></td>
							<td><div class="fun_tips">0 或 留空 表示没限制</div></td>
						</tr>
					</table>
					<div class="h_a">出租权限</div>
					<table width="100%">
						<col class="th" />
						<col width="400" />
						<col />
						<tr>
							<th>出租发布权限</th>
							<td>
								<ul class="switch_list cc">
									<li>
										<label>
											<input type="radio" value="day" name="right[hire_publish_type]" <?php echo set_radio('right[hire_publish_type]','day',isset($right['hire_publish_type']) ? $right['hire_publish_type'] == 'day' : TRUE); ?> />
											<span>按天发布</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" value="month" name="right[hire_publish_type]" <?php echo set_radio('right[hire_publish_type]','month',isset($right['hire_publish_type']) && $right['hire_publish_type'] == 'month'); ?> />
											<span>按月发布</span>
										</label>
									</li>
									<li>
										<label>
											<input type="radio" value="fixed" name="right[hire_publish_type]" <?php echo set_radio('right[hire_publish_type]','fixed',isset($right['hire_publish_type']) && $right['hire_publish_type'] == 'fixed'); ?> />
											<span>固定数量</span>
										</label>
									</li>
								</ul>
							</td>
							<td style="vertical-align:middle"><div class="fun_tips"></div></td>
						</tr>
						<tr>
							<th>出租发布数量</th>
							<td><input type="text" name="right[hire_publish_num]" value="<?php echo isset($right['hire_publish_num']) ? $right['hire_publish_num'] : ''; ?>" class="input length_5"></td>
							<td><div class="fun_tips">0 或 留空 表示没限制</div></td>
						</tr>
					</table>
				</div>
			</div>
		</div>
		<div class="btn_wrap">
			<div class="btn_wrap_pd">
				<button type="submit" class="btn btn_submit mr20">提交</button>
			</div>
		</div>
	</form>
</div>
<?php $this->load->view('admin/common_footer'); ?>
<script>
$(function(){
	//站点状态
	var ifpostall_title = {
		s1 : '开启后，单独出售出租设置无效，即合并出售出租',
		s2 : '关闭后，可以单独设置出售出租权限',
	};
	
	var checked = $('#J_ifpostall_type input:checked');
	
	ifpostallAreaShow(checked.data('type'));
	ifpostallTitle(checked.data('title'));

	$('#J_ifpostall_type input:radio').on('change', function(){
			ifpostallAreaShow($(this).data('type'));
			ifpostallTitle($(this).data('title'));
	});

	//切换显示版块
	function ifpostallAreaShow(type) {
		var ifpostall_arr= new Array();
		
		ifpostall_arr = type.split(",");
		$('.J_ifpostall_tbody').hide();
		
		$.each(ifpostall_arr, function(i, o){
			$('#'+ o).show();
		});
	}
	
	//切换提示文案
	function ifpostallTitle(title){
		$('#J_ifpostall_tip').text(ifpostall_title[title]);
	}
});
</script>
</body>
</html>